package custom_types;

import javax.persistence.Column;
import javax.persistence.Embeddable;

@Embeddable
public class Afm {
	@Column
	private int afm;

	public Afm(){}
	
	public Afm(int afm) {
		if (isValid(afm))
			this.afm = afm;
	}
	
	public boolean isValid(int afm){
		return String.valueOf(afm).length() == 8 ? true:false;
	}
	
	//Getters
	public int getAfm() { return afm; }

	//Setters
	public void setAfm(int afm) { 
		if (isValid(afm))
			this.afm = afm; 
	}	
	
}
